<?php

class CommentReplyController extends BaseController
{
    protected $tableName = "comment_reply";
    protected $pk = "cm_reply_id";

    // 重新新增对话方法
    public function post($obj)
    {
        $comment_id = $obj['comment_id'];
        $user_from = $obj['user_from'];
        $user_to = $obj['user_to'];
        $content = $obj['cm_reply_content'];
        $sql = "INSERT INTO comment_reply VALUES(0, $comment_id, $user_from, $user_to, '$content', CURRENT_TIME)";
        $result = $this->conn->query($sql);
        if ($this->judge($result)) {
            $newRecord = $this->getNewRecord($obj);
            return ReturnHelper::success($newRecord, "新增对话成功");
        }
        else {
            return ReturnHelper::failed([], "新增对话失败");
        }
    }
}